package service;

import user.Teacher;

public class TeaService {
    private Teacher[] teachers = new Teacher[1];
    int TheaCounter = 1;

    public TeaService(){
        teachers[0] = new Teacher("jack", '男', 30, "12345678", "123456","0123456789");
    }

    //添加教师
    public boolean ThSignUp(Teacher newTeacher) {
       Teacher[] newThea = new Teacher[teachers.length + 1];
       for(int i = 0; i < teachers.length; i++){
           newThea[i] = teachers[i];
       }
       newThea[teachers.length] = newTeacher;
       teachers = newThea;
       TheaCounter++;
        return true;
    }

    //教师登录
    public boolean ThLogIn(String id, String password){
        for(int i = 0; i < teachers.length; i++){
           if(teachers[i].getId().equals(id) && teachers[i].getPassword().equals(password)){
               return true;
           }
        }
        return false;
    }
}
